package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.DateTimeUtils;
import com.ybkj.daijia.page.Page;
import com.ybkj.daijia.page.Pageable;
import com.ybkj.daijia.page.impl.PageImpl;
import com.ybkj.daijia.page.impl.PageRequest;
import com.ybkj.daijia.server.mapper.DriverRebatePaymentRecordMapper;
import com.ybkj.daijia.server.model.DriverRebatePaymentRecord;
import com.ybkj.daijia.server.service.DriverRebatePaymentRecordService;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zhyu
 * @date 2019-07-19 09:06:27
 */
@Service
public class DriverRebatePaymentRecordServiceIpml implements DriverRebatePaymentRecordService {

    @Autowired
    private DriverRebatePaymentRecordMapper driverRebatePaymentRecordMapper;

    @Override
    public DriverRebatePaymentRecord insertRecord(DriverRebatePaymentRecord record) {
        return null;
    }

    @Override
    public DriverRebatePaymentRecord findOne(Long id) {
        return null;
    }

    @Override
    public List<DriverRebatePaymentRecord> listIndexPayments(Long driverId, Date start, Date end) {
        return null;
    }

    @Override
    public Page<DriverRebatePaymentRecord> queryByEmploy(Long driverId, String recordType,
        Date start, Date end, Integer page, Integer limit) {
        Pageable pageable = new PageRequest(page, limit);
        String startStr =
            null != start ? DateTimeUtils.DATE_FORMAT_DATE_yyyyMMddHHmmss.format(start) : null;
        String endStr =
            null != end ? DateTimeUtils.DATE_FORMAT_DATE_yyyyMMddHHmmss.format(end) : null;
        Long count = driverRebatePaymentRecordMapper
            .countByEmploy(driverId, startStr, endStr, recordType);
        List<DriverRebatePaymentRecord> list = driverRebatePaymentRecordMapper
            .listIndexPayments(startStr, endStr, driverId, recordType, page * limit, limit);
        return new PageImpl<>(list, pageable, count);
    }

    @Override
    public List<DriverRebatePaymentRecord> listByEmploy(Long driverId, String recordType,
        Date start, Date end) {
        return null;
    }

    @Override
    public BigDecimal sumInComeByEmployWithDate(Long driverId, Date begin, Date end) {
        return null;
    }

    @Override
    public BigDecimal sumRebateByEmployWithDate(Long driverId, Date begin, Date end) {
        return null;
    }

    @Override
    public DriverRebatePaymentRecord findOrderRecharge(Long driverId, Long orderId,
        Integer orderType) {
        return null;
    }
}
